// 安卓选择文件系统回调函数
export default {
  name: 'xblFileSelectFinish',
  handler (option = {}, code, fileName, result) {
    let base64Data = code
    let res, type, ext
    ext = fileName.substring(fileName.lastIndexOf('.') + 1)

    type = window.$ui.extToFileType(fileName)
    let mimeType = `${type}/${ext}`
    let blobAndUrl = window.$ui.base64.toBlobAndUrl(base64Data, mimeType)
    res = {
      ext,
      mimeType,
      fileType: type,
      url: blobAndUrl.url,
      fromNative: true,
      filename: fileName,
      data: blobAndUrl.blob
    }
    return {
      data: res,
      type,
      result
    }
  }
}
